import javax.swing.*;
import javax.swing.border.EmptyBorder;


public class FreeParkingUI extends JFrame {

	private JPanel contentPane;
	private JLabel jokeLabel;

	/**
	 * Create the frame.
	 */
	public FreeParkingUI() {
		setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
		setBounds(100, 100, 490, 327);
		contentPane =  new ImagePanel(new ImageIcon("Graphics/FreeParkingUIBG.png").getImage());
		this.setTitle("Weekends at Makati.");
		contentPane.setBorder(new EmptyBorder(5, 5, 5, 5));
		setContentPane(contentPane);
		
		
		ImageIcon exitPic = new ImageIcon("Graphics/ReturnToGame.png");
		ImageIcon exitPicOver = new ImageIcon("Graphics/ReturnToGameOver.png");
		JButton exitButton = new JButton(exitPic);
		exitButton.setBounds(5, 5, 474, 462);
		
		contentPane.add(exitButton);
		
		exitButton.setBounds(0, 0, 62, 28);
		
		exitButton.setBorderPainted(false);
		exitButton.setContentAreaFilled(false);
		exitButton.setOpaque(false);
		exitButton.setRolloverEnabled(true);
		exitButton.setRolloverIcon(exitPicOver);
		exitButton.addActionListener(new java.awt.event.ActionListener() {
            @Override
			public void actionPerformed(java.awt.event.ActionEvent evt) {
                exitButtonPressed(evt);
            }
        });
		this.setVisible(true);
	}
	
	private void exitButtonPressed(java.awt.event.ActionEvent e){
		
		NextPlayerCommand nextPlayerCommand = new NextPlayerCommand();
		nextPlayerCommand.execute();
		this.dispose();
		
		
	}
	
}
